const state = () => ({
    token: '',
    userInfo: {},
})
const mutations = {
    SET_USERINFO(state, value) {
        state.token = value
        uni.setStorageSync('token', value)
    },

    SET_USERINFO_DATA(state, value) {
        state.userInfo = value
    },

    RESET_INFO(state, value) {
        state.token = ''
        state.userInfo = {}
    },
}
const actions = {
    LOGOUT({commit}) {
        uni.clearStorageSync()
        commit('RESET_INFO')
        uni.navigateTo({
            url: '/pages/auth/login'
        })
    }
}
export default {
    namespaced: true,
    state,
    mutations,
    actions
}